The TADS Alternate Library
Version 2.0

Display Aggregation


Copyright 2000 by Kevin Forchione.
This is part of the TADS Alternate Library Authors Manual.

Introduction and Table of Contents




Display Aggregation

 

Alt implements a simplified form of display aggregation for multiple direct object commands. This is accomplished by capturing any display text that occurs between preCommand() and postAction(), storing the text in dynamically-created Message class objects that are kept in the queue.list until daemons and fuses are run, at which point the queue.list is processed and the stored messages are displayed.

 

Capturing Text

 

Alt uses TADS new prefixdesc method to outcapture() text occurring between preCommand() and postAction(). During postAction() all the elements of command, the command status, and any text produced are stored in dynamically-created Message class objects that are added to queue.list when they are created. For multiple direct-object commands that produce identical text display queue simply accumulates the direct-object in its queue.dolist_.

 

Processing The Message Queue

 

When daemons and fuses are run the first daemon executed is the call to process the queue.list. This process determines whether a prefixdesc should be displayed before each text message, as well as editing the display string to represent the multiple direct objects.

 

Multiple Direct Object Display Text

 

ADV.T allows you to use shorthand symbols in text messages to make them more readable, Alt builds upon this practice with the use of  _dobj_ and other shorthand symbols.

 

       “_Dobj_ _do_n’t appear interested. “

 

Before the text stored in a queue Message is displayed all _SYM_ embedded in the string are converted to values corresponding to the direct object (just as %SYM% are used by ADV.T as shorthand for actor-related values.)

 

This approach allows queue to aggregate generic messages that will later be expanded for specific objects.

 

       “%You% see%s% nothing special about _dobj_. “

 

Might be expanded by queue into:

 

          “%You% see%s% nothing special about the ball and the three coins. “

 

(Note, the %You% and %s% are handled by TADS built-in output formatter.). The symbols available are:

 

Symbol

Value

_dobj_

listdefart(queue.dolist_);

_Dobj_

caps(); Listdefart(queue.dolist_);

_it_

‘it’ / ‘they’

_It_

‘It’ / ‘They’

_s_

‘s’ / ‘’

_is_

‘is’ / ‘are’

_isn’t_

‘isn’t’ / ‘aren’t’

_does_

‘does’ / ‘do’

_has_

‘has’ / ‘have’

_a_

‘a’ / ‘some’

_an_

‘an’ / ‘some’

 

Additionally, a conversion is done when queue determines that a text string contains an occurrence of an object sDesc that should really be a pluralDesc.

 

“_It_ look_s_ like _an_ ordinary <<self.sDesc>> to me. “

 

Suppose that the queue.dolist_ contains [ coin1 coin2 coin3 ], then the above is converted to:

 

       “They look like some ordinary coins to me. “

 

 

Display Suppression

 

Alt captures text at various points in the command execution phase using the TADS 2 built-in outcapture() function. The details of display capture are as follows:

 

Parser Hook

Description

preCommand()

The outcapture() is set for cases where there are no direct- or indirect-objects.

obj.prefixdesc

The outcapture() is set for each direct-object of either a single- or multiple-object command.

verb.verbAction()

Retrieve any display outcaptured from preCommand() / obj.prefixdesc. Capture displays from object reactions. Queue any messages and set the outcapture().

postAction()

Retrieve any display outcaptured from action, verification, dobjCheck(), and dobjGen() methods, whether exited through normal return or through exit, exitobj, or abort. Capture displays from object postAction reactions. Queue any messages and set the queue.stat to nil.

fuse – queue.processQueue

Process the queue.list of captured displays each turn.

endCommand()

Retrieve any display outcaptured from aborted preCommand() and display it. Process any messages still pending in the queue. Process obj endCommand reactions and aggregate them then process the queue. Set the queue.stat to nil and reset various variables.

 

These hooks perform the important task of capturing all displayed output that must be aggregated during command execution. Because of the outcapturing spans the entire command execution phase care must be taken in your code to avoid breaking the sequence of outcaptured and displayed data.

 

Special Wrapper Functions

 

Aggregate display requires the use of special wrapper functions (See Special Wrapper Functions) to ensure the integrity of the outcapture and queuing display mechanism.